<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>积分排行榜</title>
<link type="text/css" href="__CSS__/main.css" rel="stylesheet"/>
<link type="text/css" href="__CSS__/wild.css" rel="stylesheet"/>
<script type="text/javascript" src="__PUBLIC_JS__/jquery.js?v={$src_version}" ></script>
<!-- banner滚动 -->
<script type="text/javascript" src="__JS__/jquery-1.10.1.min.js"></script>
<script>$.noConflict();</script>
<script type="text/javascript" src="__JS__/owl.carousel.js"></script>
<script type="text/javascript" src="__JS__/zepto.min.js" ></script>
<script type="text/javascript" src="__JS__/fastclick.js" ></script>
<script type="text/javascript" src="__JS__/layer_mobile/layer.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/ming.js?v={$src_version}"></script>
</head> 
<body>
 
<div class="reback"><img src="__IMG__/reback.svg" onclick="javascript:history.back(-1);"></div>
<!-- 默认周排行 -->
<div class="rank-head">
        <img class="rank_badge" src="__IMG__/rank/rank_badge.png" alt="积分排行徽章">
        <p class="rank-rank paiming">0</p>
        <p class="rank-integral">积分:<span>{$ci}</span></p>
        <div class="rank-classification">
            <span class="person branch_active"  data-branch="0" data-status="true" > <a class="branch_click">个人排行</a></span>
            <span class="department" data-branch="1" ><a class="branch_click" >部门排行</a></span>
        </div>
    </div>
    <ul class="rank-filter">
        <li class="filter all active" data-type="year" data-status="true"><span class="month_click">总</span></li>
        <li class="filter month" data-type="moth"><span class="month_click">月</span></li>
        <li class="filter week" data-type="week"><span class="month_click">周</span></li>
        <li class="filter-rank" data-rank="">
            <span class="desc_click"  data-rank="asc" data-status="true"><img src="__IMG__/rank/asc.png" ></span>
        </li>
    </ul>
    <div class="rank-item-special">
        <span>排行</span>
        <span>用户</span>
        <span class="right">积分</span>
    </div>
    <div class="rank-box">
    </div>
</body>
</html>
<script>
        $('.rank-classification').on('click',' span',function(){
            $(this).addClass('branch_active').siblings().removeClass('branch_active');
            $(this).attr('data-status','true').siblings().removeAttr('data-status');
            //获取数据
            var branch=$('.rank-classification span[data-status="true"]').attr('data-branch'),
                type=$('.rank-filter li[data-status="true"]').attr('data-type'),
                rank=$('.filter-rank span[data-status="true"]').attr('data-rank');
            data_ajax(branch,type,'asc');
        })
        $('.rank-filter .filter').click(function(){
            $(this).addClass('active').siblings().removeClass('active');
            $(this).attr('data-status','true').siblings().removeAttr('data-status');
            var branch=$('.rank-classification span[data-status="true"]').attr('data-branch'),
                type=$('.rank-filter li[data-status="true"]').attr('data-type'),
                rank=$('.filter-rank span[data-status="true"]').attr('data-rank');
            data_ajax(branch,type,'asc');
        })
        $('.rank-filter .desc_click').click(function(){
          var branch=$('.rank-classification span[data-status="true"]').attr('data-branch'),
            type=$('.rank-filter li[data-status="true"]').attr('data-type'),
            rank=$('.filter-rank span[data-status="true"]').attr('data-rank');
        data_ajax(branch,type,rank);
        })
        var branch=$('.rank-classification span[data-status="true"]').attr('data-branch'),
        type=$('.rank-filter li[data-status="true"]').attr('data-type'),
        rank=$('.filter-rank span[data-status="true"]').attr('data-rank');
        data_ajax(branch,type,rank);
function data_ajax(branch,month,rank){
    $.post('/index/user/allrank_ajax',{branch_id:branch,month:month,desc:rank},function(data){
        var str='';
        $('.rank-box').html('');
        if(data.code=200){
            for(var i=1;i<=data.data.list.length;i++){
                if(data.data.list[i-1].uid == data.data.uid){
                        $('.paiming').html(i);
                }
                if(data.data.desc == 'asc'){
                    $(".desc_click img").attr('src','__IMG__/rank/desc.png');
                    $(".desc_click").attr('data-rank','desc');
                }else{
                    $(".desc_click img").attr('src','__IMG__/rank/asc.png');
                    $(".desc_click").attr('data-rank','asc');
                }
                str+='<div class="rank-item">\
                        <span class="u-id" style="display: none;">'+data.data.list[i-1].uid+'</span>\
                        <span class="rank-ranking">'+i+'</span>\
                        <span class="rank-item-name">'+data.data.list[i-1].realname+'</span>\
                        <span class="right">'+data.data.list[i-1].sum+'</span>\
                    </div>';
            }
        }
        $('.rank-box').append(str);
    },'json');
}
</script>